﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Librarian.Shared;

namespace Librarian.Pocket
{
    public partial class GridForm : Form
    {
        public GridForm()
        {
            InitializeComponent();            
        }

        public EzSearchOptions SearchOptions { get; set; }
        public string FilterText { get; set; }

        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            if ((e.KeyCode == System.Windows.Forms.Keys.Up))
            {
                // Subir oscilador
                // Subir
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Down))
            {
                // Bajar oscilador
                // Bajar
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Left))
            {
                // Izquierda
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Right))
            {
                // Derecha
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Enter))
            {
                // Entrar
            }

        }      

        public void Find()
        {
            DataTable t = dataGrid1.DataSource as DataTable;
            dataGrid1.DataSource = null;
            if (t != null)
            {
                t.Dispose();
            }
            t = null;
            dataGrid1.DataSource = SearchEngine.FindText(FilterText, SearchOptions);
            dataGrid1.Refresh();
        }
    }
}